package daoImpl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import org.springframework.stereotype.Repository;

import model.Tag;

@Repository("tagDAOImpl")
public class TagDAOImpl {

	public boolean saveTag(Tag tag, int expID){
		Connection conn;
		Boolean saved = false;
		String tagBody = tag.getTag();
		int tagID = tag.getTagID();
		
		try {
			conn = util.DatabaseUtils.dbConnection();
			String query = "INSERT INTO TagExperienceCon (tagID, expID, tagbody) "
					+ "VALUES ("+tagID+" "+expID+" "+tagBody+")";
			PreparedStatement  statement = conn.prepareStatement(query);
			saved = statement.execute();
		} catch (SQLException e) {
			System.out.println("Database error" + e.toString());
		} catch (Exception e) {
			System.out.println("Database error" + e.toString());
		}
		
		return true;
	}
}
